<?php
/*
	
*/
defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$setting=$this->plugin_setting('basic');
$return['banner']=$setting['hdps'];
$return['setting']=$setting;
if($_RQ['op']=='list'){
	$params=array('uniacid'=>$_SESSION['uniacid'],'status'=>'1');
	if($_RQ['keyword']){
		$params['title like']='%'.trim($_RQ['keyword']).'%';
	}
	//状态为显示的所有活动，排序
	$list=pdo_getall('jy_dati_list',$params,'','','paixu asc');
	foreach($list as &$item){
		if($item['mannum']-$item['num'] >= 0){
			$item['left']=$item['mannum']-$item['num'];
		}else{
			$item['left']=0;
		}
		$item['danum']=pdo_count('jy_dati_canyu',array('uniacid'=>$_SESSION['uniacid'],'datiid'=>$item['id']));
	}
	set_html('title','首页');
	$return['post']=array();
	$return['list']=$list;
	$return['sharedata']=array(
		'title'=>$setting['share_title'],
		'desc'=>$setting['share_desc'],
		'link'=>custom_url('jy_dati/index/list',true),
		'imgUrl'=>ATTACHMENT_URL.$setting['share_image'],
	);
	exi($return);
}
